import {createRouter, createWebHistory} from 'vue-router';
import Home from "../views/Home/index.vue"

const routerHistory = createWebHistory();

const routes = [
    {
        name: "Home",
        path: "/",
        component: Home,
        meta: {
            title: "首页",
            id: "Home",
        }
    },
    {
        path: '/:pathMatch(.*)',     //通配符,任何找不到页面都可以调到此处
        name: '404',
        hidden: true,
        component: () => import('../views/Home/index.vue'),
        meta: {
            title: "首页",
            id: "Home",
        }
    }
]

const modules = import.meta.glob('../views/**/*.vue')
const getViews = () => {
    return modules['../views' + path]
}
const router = createRouter({
    history: routerHistory,
    routes: routes,
});
export default router
